﻿// -----------------------------------------------------------------------
// <copyright file="BackEndDeveloperBase.cs" company="SoftServe">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace SoftServe.HrManager.Models
{
    using System;
    using System.Collections.Generic;

    using SoftServe.HrManager.Abstractions;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public abstract class BackEndDeveloperBase : IDeveloper, IEquatable<IDeveloper>
    {
        public const string DefaultName = "Default back-end name";

        protected BackEndDeveloperBase()
        {
            Name = DefaultName;
        }

        protected BackEndDeveloperBase(string name)
        {
            Name = name;
        }

        #region IDeveloper implementation

        public string Name { get; set; }

        public IEnumerable<eSkillName> Skills { get; set; }

        public void WriteCode()
        {
            WriteBackEndCode();
        }

        #endregion

        #region IEquatable<IDeveloper> implementation

        public bool Equals(IDeveloper other)
        {
            if (other != null)
            {
                return string.Compare(other.Name, Name, true) == 0
                    & other.GetType().IsAssignableFrom(typeof(BackEndDeveloperBase));
            }
            return false;
        }

        #endregion


        public abstract void WriteBackEndCode();

        public abstract void WriteDBHostCode();
    }
}
